package com.carpark.ejb.Model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Krzysztof
 */
@Entity
@Table(name = "services")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ServicesModel.findAll", query = "SELECT s FROM ServicesModel s"),
    @NamedQuery(name = "ServicesModel.findByServiceId", query = "SELECT s FROM ServicesModel s WHERE s.serviceId = :serviceId"),
      @NamedQuery(name = "ServicesModel.findByClient", query = "SELECT s FROM ServicesModel s WHERE s.clientId = :clientId"),
    @NamedQuery(name = "ServicesModel.findByModificationDate", query = "SELECT s FROM ServicesModel s WHERE s.modificationDate = :modificationDate"),
    @NamedQuery(name = "ServicesModel.findByComment", query = "SELECT s FROM ServicesModel s WHERE s.comment = :comment")})
public class ServicesModel implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ServiceId")
    private Integer serviceId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ModificationDate")
    @Temporal(TemporalType.DATE)
    private Date modificationDate;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "Comment")
    private String comment;
    @JoinColumn(name = "EployeeId", referencedColumnName = "EmployeeId")
    @ManyToOne(optional = false)
    private EmployeesModel eployeeId;
    @JoinColumn(name = "ClientId", referencedColumnName = "ClientId")
    @ManyToOne(optional = false)
    private ClientsModel clientId;

    public ServicesModel() {
    }

    public ServicesModel(Integer serviceId) {
        this.serviceId = serviceId;
    }
    
    public ServicesModel(Date modificationDate, String comment) {
        this.modificationDate = modificationDate;
        this.comment = comment;
    }
    
    public ServicesModel(Integer serviceId, Date modificationDate, String comment) {
        this.serviceId = serviceId;
        this.modificationDate = modificationDate;
        this.comment = comment;
    }

    public Integer getServiceId() {
        return serviceId;
    }

    public void setServiceId(Integer serviceId) {
        this.serviceId = serviceId;
    }

    public Date getModificationDate() {
        return modificationDate;
    }

    public void setModificationDate(Date modificationDate) {
        this.modificationDate = modificationDate;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public EmployeesModel getEployeeId() {
        return eployeeId;
    }

    public void setEployeeId(EmployeesModel eployeeId) {
        this.eployeeId = eployeeId;
    }

    public ClientsModel getClientId() {
        return clientId;
    }

    public void setClientId(ClientsModel clientId) {
        this.clientId = clientId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (serviceId != null ? serviceId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ServicesModel)) {
            return false;
        }
        ServicesModel other = (ServicesModel) object;
        if ((this.serviceId == null && other.serviceId != null) || (this.serviceId != null && !this.serviceId.equals(other.serviceId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.carpark.ejb.Model.ServicesModel[ serviceId=" + serviceId + " ]";
    }
    
}
